## RArray signal class.  Represents arrays in R.

from RMatrix import RMatrix

class RArray(RMatrix):
    def __init__(self, data, parent = None, checkVal = True):
        RMatrix.__init__(self, data = data, parent = parent, checkVal = False)
        
        if checkVal:
            if 'array' not in self.R('class('+data+')') and 'matrix' not in self.R('class('+data+')'):
                print self.R('class('+data+')')
                raise Exception, 'Data not of array class'
                
        self.data = data
        
        if parent:
            self.parent = parent
        else:
            self.parent = data
            
    def convertToClass(self, varClass):
        try:
            return RMatrix.convertToClass(self, varClass)
        except Exception as inst:
            print inst
            return self
        